Note: There are often multiple ways to answer each question.
Assign the character string “11” to x
and the character string “22” to y
.
What is the result of x + y
? Why does R return this result?
If we wanted to treat the contents of x
and y
as numbers and add them, how could we do that?
Save the (numeric) result from Qn 3 in the variable z
. Compute the square root of z
.
Remove all the variables that you have created from the environment.
Your friend Jack wants to print the string “STATS_32” to the console. He enters the following command but encounters an error. What went wrong? What should he have done instead?
print(STATS_32)
## Error in print(STATS_32): object 'STATS_32' not found
NA + 2
? Why do you think that is?